#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# ======================================================
# @File:      : test27
# @Author     : forward_huan
# @Date       : 2024/11/16 15:13
# @Desc       :
# ======================================================
from typing import List


class Solution:
    def rotate(self, nums: List[int], k: int) -> None:
        """
        Do not return anything, modify nums in-place instead.
        """
        k = k % len(nums)
        temp = nums[-k:]
        for i in range(len(nums) - 1, k - 1, -1):
            nums[i] = nums[i - k]
        for i in range(len(temp)):
            nums[i] = temp[i]
        print(nums)


print(Solution().rotate(nums=[1, 2, 3, 4, 5, 6, 7], k=3))
print(Solution().rotate(nums=[-1, -100, 3, 99], k=2))
print(Solution().rotate(nums=[1, 2], k=3))
